package cn.iocoder.yudao.module.api.promotion.gift.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.Objects;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/03/18
 */
@Getter
@RequiredArgsConstructor
public enum GiftGiveType implements EnumValuable {
    UNKNOWN(-1, "赠品"),
    OFFLINE_PRODUCT(0, "线下产品"),
    ONLINE_PRODUCT(1, "线上产品"),
    COUPON_TEMPLATE(2, "优惠券"),
    ;

    @EnumValue
    private final Integer value;
    private final String name;

    public static GiftGiveType valueOf(Integer value) {
        return Arrays.stream(values())
                .filter(method -> Objects.equals(method.value, value))
                .findFirst()
                .orElse(UNKNOWN);
    }

}
